<?php
class getData {
	var $dataString;
	
	function getDisabilities($render='select') {
		global $dbname, $db, $db_selected;
		
		$sql = "SELECT * from cdc_sysDisabilities 
				WHERE Active = 1 
				ORDER BY DisabilityName";
		$result = mysql_db_query($dbname,$sql);
		$j=0;
		while ($value = mysql_fetch_array($result)) {
			if ($render == 'select') {
				$disID = $value['DisabilityID'];
				$disName = stripslashes($value['DisabilityName']);
				$this->dataString .= '<option value="'.$disID.'">'.$disName.'</option>';
			}
		}
		
	}
	
	function getOrPTIRegions($render='select') {
		
	}	
	
	function getDirFromCategory($catID) {
		global $dbname, $db, $db_selected;
		$returnArray = array();
		
		$sql2 = "SELECT ParentID,SiteArea,DirectoryName from cdc_sysCategory WHERE CatID = '".$catID."'";
		$result2 = mysql_db_query($dbname,$sql2);
		$row2 = mysql_fetch_assoc($result2);
		if ($row2['ParentID'] == 0) {
			$returnArray['MainCatID']  = $catID;	
			$returnArray['MainCatDir'] = $row2['DirectoryName'];
			$returnArray['CatPath']    = $returnArray['MainCatDir']; 		
		} else {
			$returnArray['MainCatID'] = $row2['ParentID'];
			$returnArray['SubCatID']  = $catID;
			
			$sql3 = "SELECT DirectoryName from cdc_sysCategory WHERE CatID = '".$returnArray['MainCatID']."'";
			$result3 = mysql_db_query($dbname,$sql3);
			$row3 = mysql_fetch_assoc($result3);
			
			$returnArray['MainCatDir'] = $row3['DirectoryName'];
			$returnArray['SubCatDir']  = $row2['DirectoryName'];
			$returnArray['CatPath']  = $returnArray['MainCatDir'].'/'.$returnArray['SubCatDir'];
		}
		$returnArray['SiteArea'] = $row2['SiteArea']; 
		$this->dataString = $returnArray;
	}
	
	function returnData() {
		return $this->dataString;
	}
}
?>